import React, { Component } from "react"
import {NavLink} from "react-router-dom"
export default class Public extends Component {
    constructor(props) {
        super(props)
        this.state = {
            flag: false
        }
    }
    change() {
        console.log(123)
        console.log(this.state.flag,1)
        this.setState((preState, props) => {
            return {
                flag: !preState.flag
                
            }
        })
        console.log(this.state.flag,2)
    }
    render() {
        let { list } = this.props
        return <div className="box-top">
                
                    <div className="fix-top">
                        <i className={list[0]} onClick={this.change.bind(this)}></i>
                        <p><span className={list[1]}>{list[1].indexOf("iconfont") === -1 ? list[1] : ''}</span></p>
                        <i className={list[2]}></i>
                    </div>
                    <ul style={{ "display": this.state.flag ? 'block' : "none" }}>
                        <li>
                           <NavLink to="/detail">
                               <i className="iconfont icon-shopping-bag"></i>
                               <p>锤子商城</p>
                           </NavLink>
                        </li>
                        <li>
                           <NavLink to="/detail">
                               <i className="iconfont icon-shouji1"></i>
                               <p>坚果 Pro 2S</p>
                           </NavLink>
                        </li>
                        <li>
                           <NavLink to="/detail">
                               <i className="iconfont icon-shouji"></i>
                               <p>坚果 R1</p>
                           </NavLink>
                        </li>
                        <li>
                           <NavLink to="/detail">
                               <i className="iconfont icon-station"></i>
                               <p>坚果 TNT 工作站</p>
                           </NavLink>
                        </li>
                        <li>
                           <NavLink to="/detail">
                               <i className="iconfont icon-shouji2"></i>
                               <p>坚果 3</p>
                           </NavLink>
                        </li>
                        <li>
                           <NavLink to="/detail">
                               <i className="iconfont icon-chuizi"></i>
                               <p>Smartisan OS</p>
                           </NavLink>
                        </li>
                        <li>
                           <NavLink to="/detail">
                               <i className="iconfont icon-xiazai"></i>
                               <p>应用</p>
                           </NavLink>
                        </li>
                        <li>
                           <NavLink to="/detail">
                               <i className="iconfont icon-24"></i>
                               <p>论坛</p>
                           </NavLink>
                        </li>
                        <li>
                           <NavLink to="/detail">
                               <i className="iconfont icon-fuwu1"></i>
                               <p>服务支持</p>
                           </NavLink>
                        </li>
                        

                    </ul>
                
            </div>
    }
}